#include <iostream>
#include <exception>


class MyException:public std::exception
{
public:
    const char* what()const noexcept //当前函数不会抛出异常
    {
        return "我自己的异常!";
    }
};

void func()
{
    throw MyException();
}


void handle()
{
    try
    {
        func();
    }
    catch(const std::exception& e)
    {
        //显示错误信息
        std::cerr << e.what() << std::endl;
    }

}

int main()
{
    handle();
    return 0;
}